mbedtls: Namespace TF specific macros
authordp-arm <[email protected]>
Tue, 7 Mar 2017 10:08:42 +0000 (10:08 +0000)
committerdp-arm <[email protected]>
Wed, 22 Mar 2017 15:30:05 +0000 (15:30 +0000)
These macros are not part of mbed TLS so they should not be prefixed
with `MBEDTLS_` to avoid potential collision in the future. Use the
`TBBR_` suffix to highlight that they only used in TF.

`MBEDTLS_KEY_ALG` was not modified because that is documented and used
by platforms to select the key algorithm.

Change-Id: Ief224681715c481691c80810501830ce16e210b0
Signed-off-by: dp-arm <[email protected]>
drivers/auth/mbedtls/mbedtls_common.c
drivers/auth/mbedtls/mbedtls_crypto.mk
include/drivers/auth/mbedtls/mbedtls_config.h

index 053bf1a4940349184b1c5d1617f76c9e8820377e..1d2df5a53ae87e27105a3f32d0501711ca32d9b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -36,9 +36,9 @@
 /*
  * mbed TLS heap
  */
-#if (MBEDTLS_KEY_ALG_ID == MBEDTLS_ECDSA)
+#if (TBBR_KEY_ALG_ID == TBBR_ECDSA)
 #define MBEDTLS_HEAP_SIZE              (14*1024)
-#elif (MBEDTLS_KEY_ALG_ID == MBEDTLS_RSA)
+#elif (TBBR_KEY_ALG_ID == TBBR_RSA)
 #define MBEDTLS_HEAP_SIZE              (8*1024)
 #endif
 static unsigned char heap[MBEDTLS_HEAP_SIZE];
index b7880971af18fbb78800c5323bd7840ae7b6243b..302a0a1cc09ab9afa380500227be6bab9e50fa0d 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
@@ -55,18 +55,18 @@ ifeq (${MBEDTLS_KEY_ALG},ecdsa)
                                        ecp_curves.c                            \
                                        ecp.c                                   \
                                        )
-    MBEDTLS_KEY_ALG_ID         :=      MBEDTLS_ECDSA
+    TBBR_KEY_ALG_ID            :=      TBBR_ECDSA
 else ifeq (${MBEDTLS_KEY_ALG},rsa)
     MBEDTLS_CRYPTO_SOURCES     +=      $(addprefix ${MBEDTLS_DIR}/library/,    \
                                        rsa.c                                   \
                                        )
-    MBEDTLS_KEY_ALG_ID         :=      MBEDTLS_RSA
+    TBBR_KEY_ALG_ID            :=      TBBR_RSA
 else
     $(error "MBEDTLS_KEY_ALG=${MBEDTLS_KEY_ALG} not supported on mbed TLS")
 endif
 
-# mbed TLS libraries rely on this define to build correctly
-$(eval $(call add_define,MBEDTLS_KEY_ALG_ID))
+# Needs to be set to drive mbed TLS configuration correctly
+$(eval $(call add_define,TBBR_KEY_ALG_ID))
 
 BL1_SOURCES                    +=      ${MBEDTLS_CRYPTO_SOURCES}
 BL2_SOURCES                    +=      ${MBEDTLS_CRYPTO_SOURCES}
index a8d7241520f867ee8c018fd13aa88f88b40c1b23..9fce42422bcb9cc2384804c4ec4b4956cc6f2914 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -33,8 +33,8 @@
 /*
  * Key algorithms currently supported on mbed TLS libraries
  */
-#define MBEDTLS_RSA                    1
-#define MBEDTLS_ECDSA                  2
+#define TBBR_RSA       1
+#define TBBR_ECDSA     2
 
 /*
  * Configuration file to build mbed TLS with the required features for
 
 #define MBEDTLS_PLATFORM_C
 
-#if (MBEDTLS_KEY_ALG_ID == MBEDTLS_ECDSA)
+#if (TBBR_KEY_ALG_ID == TBBR_ECDSA)
 #define MBEDTLS_ECDSA_C
 #define MBEDTLS_ECP_C
 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
-#elif (MBEDTLS_KEY_ALG_ID == MBEDTLS_RSA)
+#elif (TBBR_KEY_ALG_ID == TBBR_RSA)
 #define MBEDTLS_RSA_C
 #endif